home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / MATHS / ARCAUT / Automatons / GenDrift < prev    next >
Text File  |  1991-07-27  |  1KB  |  46 lines

  1. AUTOMATON*
  2.  
  3.   Genetic_Drift
  4.  
  5.   Using the Moore neighbourhood, this represents a naive approach to particle
  6.   diffusion. Each cell is replaced by one of it's eight neighbours which is
  7.   randomly chosen. A little thought though, shows that the number of
  8.   particles of each state is not preserved; some cells are forgotten by the
  9.   following generation, others are duplicated within several neighbouring
  10.   cells. However this process does bare some relation to reality; imagine
  11.   each cell chooses one of it's eight neighbours as a parent. It then
  12.   inherits the genes (cell state) of that cell at the next generation. The
  13.   resulting patterns of colour which spread across the screen illustrate how
  14.   this genetic information moves in space as the generations proceed.
  15.   Compare with 'Brownian Motion'.
  16.  
  17. INITIALISATION*
  18.  
  19.   10DEF PROCdo
  20.   20*SetEval wrap on
  21.   30ENDPROC
  22.  
  23. SCREEN*
  24.  
  25.   10DEF PROCdo
  26.   20DIM buf% 256:SYS "OS_ReadVarVal","sux",buf%,256
  27.   30a%=!buf%:r%=.8*a%
  28.   40GCOL 63:CIRCLE FILL a%,a%,r%
  29.   50GCOL 48:CIRCLE FILL -a%,a%,r%
  30.   60GCOL 12:CIRCLE FILL a%,-a%,r%
  31.   70GCOL 3:CIRCLE FILL -a%,-a%,r%
  32.   80ENDPROC
  33.  
  34. CODE*
  35.  
  36. ( READ_NEIG 8RND
  37.   DUP 0 = IF (TM ==)
  38.   DUP 1 = IF (BM ==)
  39.   DUP 2 = IF (ML ==)
  40.   DUP 3 = IF (TL ==)
  41.   DUP 4 = IF (TR ==)
  42.   DUP 5 = IF (BL ==)
  43.       6 = IF (BR ==)
  44.               MR ==  )
  45.  
  46. END*